package com.film.admincontroller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.service.ReviewService;
import com.film.service.impl.ReviewServiceImpl;

@WebServlet("/ReviewController")
public class ReviewController extends HttpServlet {
	
	private ReviewService reviewService = new ReviewServiceImpl();

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 int i= Integer.parseInt(request.getParameter("id"));
		 ReviewService service = new ReviewServiceImpl();
		 HttpSession session = request.getSession();
		 //删除中间表
		 int result = reviewService.deleteReviewPraise(i);
		 System.out.println("评论id"+i);
		 System.out.println("返回结果"+result);
		 
		 reviewService.updateReviewScore(i);
		 
		 response.sendRedirect("/film/ReviewTypePage.do?page=1");
		 
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
